Comparison of documents possessed by two parties

ABSTRACT

A method of zero-knowledge document comparison between two parties. Each party performs: exchanging a set of random data and a shared hash function, applying the hash function to concatenations of the document and the sets of random data, and comparing the hashes.

TECHNICAL FIELD

This application is a continuation application claiming priority to Ser. No. 10/621,731, filed Jul. 17, 2003.

The invention relates to the field of cryptography and more particularly to zero-knowledge methods for comparing documents between two parties.

BACKGROUND ART

A zero-knowledge protocol, as in other types of interactive proofs, is a protocol between two parties in which one party (the prover), tries to prove a fact to the other party (the verifier). The fact is typically secret information such as a password or, in cryptographic applications, the private key of a public key encryption algorithm. In zero-knowledge protocols, the prover can convince the verifier that he is in possession of the secret without revealing the secret itself. In particular, zero-knowledge protocols are cryptographic protocols in which: 1) the verifier cannot learn anything from the protocol—no knowledge is transferred; 2) the prover cannot cheat the verifier and vice versa; and 3) the verifier cannot pretend to be the prover to any third party. Thus in a zero-knowledge protocol the fact or secret itself, or any other useful information, is not revealed to the other party during the protocol, nor to any eavesdropper. The Fiat-Shamir protocol was the first practical zero-knowledge cryptographic protocol.

Hash functions are commonly used in cryptography. A one-way hash function is a function that takes a variable-length input string and converts it into a fixed-length output string. An example of such a hash function is the SHA-1 function. It is impossible to determine the input string from the hashed string.

In some situations where A and B are two distrustful parties, it may be necessary for the parties to learn whether two documents which are possessed by the respective parties are the same or substantially the same. For example, B may claim to have a copy of A's secret document and A's course of action may hinge on whether B's claim is true. Neither party however can disclose their respective document to the other in order to verify B's claim without destroying their secrecy. While the use of zero-knowledge protocols is known for exchanging secret keys it has not been used for comparing documents.

There is a need therefore a strong zero-knowledge document comparison method between mutually distrustful parties.

DISCLOSURE OF INVENTION

The present invention therefore provides a method of securely comparing a first document in possession of a first party and a second document in possession of a second party, without revealing the contents of the first document to the second party or the contents of the second document to the first party, said method comprising the steps of:

-   -   i) said first and second parties each generating its own set of         random data;     -   ii) each party exchanging the set of random data and a shared         hash function with the other party;     -   iii) each party computing a first value consisting of the output         of the shared hash function where the input to the hash function         is the consecutive concatenation of the document in each party's         possession, followed by that party's set of random data,         followed by the other party's set of random data;     -   iv) each party computing a second value consisting of the output         of the shared hash function where the input to the hash function         is the consecutive concatenation of the document in each party's         possession, followed by the other party's set of random data,         followed by that party's set of random data;     -   v) each party sending its first value to the other party and         receiving the other party's first value; and     -   vi) each party comparing the other party's first value to its         second value;     -   vii) each party concluding that if the values are the same, then         the two documents are the same, but that otherwise the two         documents are different.

The invention further provides a computer program product and an article for carrying out the method.

BRIEF DESCRIPTION OF DRAWINGS

In drawings which disclose a preferred embodiment of the invention:

FIG. 1 is a schematic illustration of a computer network according to the present invention; and

FIG. 2 is a flow chart illustrating the method of the invention.

BEST MODE(S) FOR CARRYING OUT THE INVENTION

With reference to FIG. 1, a communications link, such as a computer network, is designated generally as 10. Parties A and B, who distrust each other, communicate between their respective computers 12 and 14, which have central processors and are capable of generating random numbers, and comparing numbers. A possesses a document containing information, in electronic form or otherwise, referred to as document 1. B possesses a document containing information, in electronic form or otherwise, referred to as document 2. Parties A and/or B, would like to take some further action only if one or the other or both can be assured that they both have the same document. They may not care to know each other's identity.

If the respective documents, document 1 and document 2, are not already in the form of a bit string, they are scanned or otherwise converted to that format. Next, A sends B a collection of random bits, Ra, preferably incorporating a timestamp. B sends A a collection of random bits, Rb, preferably incorporating a timestamp. A compares Ra to Rb and aborts the comparison if they are the same, since the comparison will only work if the random numbers generated by A and B are different. Similarly B compares Rb to Ra and aborts the comparison if they are the same. They will then restart and generate fresh random numbers if they wish to continue.

Once A and B have exchanged non-identical random strings Ra and Rb, and have agreed on one-way hash functions H₁, H₂, A computes first ValueA by concatenating document 1 with Ra and Rb, in that order, to form a string document 1+Ra+Rb, in that order and then applying to that string a one-way hash function H₁. Any suitable cryptographic one-way hash function, such as the SHA-1 function, may be used. A then computes second ValueA by concatenating document 1+Rb+Ra, in that order, and applying to it one-way hash function H₂. Similarly B computes first ValueB by concatenating document 2 with Rb and Ra, in that order, to form a string document 2+Rb+Ra, in that order, and then applying to that string one-way hash function H₂. B then computes second ValueB by concatenating document 2 with Ra and Rb, in that order, to form a string document 2+Ra+Rb, in that order, and then applying to that string a one-way hash function H₁. Hash functions H₁ and H₂ may be the same.

It has been agreed upon beforehand that A will transmit the encrypted string first ValueA first to B, although the method will work regardless of which party sends the encrypted string to the other first. Upon completion of the foregoing steps, A sends B a message indicating that it has computed first ValueA and second ValueA, and either before, after, or at the same time as A sends that message, B sends A a message indicating that it has computed first ValueB and second ValueB. A then sends B first ValueA. B sends A first ValueB immediately upon receipt of A's first ValueA. If A does not receive B's first ValueB within a few milliseconds (in the absence of some other explanation such as a communication breakdown), A knows B did not have the same document and is trying to gain an advantage over A.

If A receives B's first ValueB in a timely way, A compares the received first ValueB with its own second ValueA. B also compares the received first ValueA with its own second ValueB. If the comparisons fail, then A and B know they statistically have different documents, and if the comparison does not fail, then statistically they have the same document. With that knowledge they may then proceed with their intended actions, or not.

Such comparisons may allow for a certain statistical dissimilarity in the strings or range of equivalence. A strict application of a hash function such as SHA-1 to a bit stream, such as a document, will produce a value that is statistically impossible to produce by supplying a second different meaningful bit stream. A strict application of the hash function does not allow for variance resulting from transmission errors or conversion between formats. Such variances would typically result in different hash codes. However, it is possible to describe a process where minor variation in the source can be handled. A document may be normalized before being passed to a hash function, or a hash function could be constructed that handles the normalization internally as part of the implementation. In this way inconsequential differences in the documents such as case type and spacing can be ignored.

For example, the parties could agree that whitespace (such as spaces, tabs and carriage returns) and character case are insignificant. The document could then be converted to a normalized form where there is no whitespace and all the characters are lowercase. The other approach would be to make the hash function ignore whitespace and change characters to lowercase before injection into the rest of the algorithm.

Thus it will be seen that according to this method, A and/or B cannot prove anything to a third party without revealing documents. A and B do not exchange the actual documents or hashed documents. Further, A or B cannot fool another party C into thinking it has the document by mirroring, resending or replaying the hash received from the other party to the third party. B cannot assert computational delay as they have previously asserted a pre-computation.

The present invention is described above as a computer-implemented method. It may also be embodied as a computer hardware apparatus, computer software code or a combination of same. The invention may also be embodied as a computer-readable storage medium embodying code for implementing the invention. Such storage medium may be magnetic or optical, hard or floppy disk, CD-ROM, firmware or other storage media. The invention may also be embodied on a computer readable modulated carrier signal.

As will be apparent to those skilled in the art in the light of the foregoing disclosure, many alterations and modifications are possible in the practice of this invention without departing from the spirit or scope thereof. Accordingly, the scope of the invention is to be construed in accordance with the substance defined by the following claims.

The embodiments of the invention in which an exclusive property or privilege is claimed are defined as follows: 

1. A computer program product comprising a computer usable storage medium having computer readable program code means embodied in said medium, said program code configured to perform a method of securely comparing a first document in possession of a first party and a second document in possession of a second party, without revealing the contents of the first document to the second party or the contents of the second document to the first party, said method comprising the steps of: i) said first and second parties each generating its own set of random data; ii) each party exchanging said set of random data and a shared hash function with the other party; iii) each party computing a first value consisting of the output of said shared hash function where the input to the hash function is the consecutive concatenation of the document in each said party's possession, followed by that party's set of random data, followed by the other party's set of random data; iv) each party computing a second value consisting of the output of said shared hash function where the input to the hash function is the consecutive concatenation of the document in each said party's possession, followed by the other party's set of random data, followed by that party's set of random data; v) each party sending its first value to the other party and receiving the other party's first value; vi) each party comparing said other party's first value to its second value; vii) each party concluding that if the said values are the same, then the two documents are the same, but that otherwise said two documents are different; viii) after computing said first and second values according to steps iii) and iv) above, each said first and second parties sending confirmation to the other party that each said party's first and second values have been computed, and waiting for said confirmation from said other party that each said party's first and second values have been computed before proceeding; ix) after one party has sent its first value to the other party according to step v) above, aborting the comparison if the other party does not respond with its first value within a pre-determined length of time; x) after step i) and before step ii), each party examining the other party's set of random data for suitability and aborting the comparison if suitability is not established, wherein said other party's random data is determined to be unsuitable if it is identical to said examining party's set of random data. 